package inbound;

import filter.IpFilterRuleHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.ipfilter.RuleBasedIpFilter;

/**
 * @author liutao
 * Date 2021/7/15 12:35 下午
 * Description:
 * Version: 1.0
 **/
public class ServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        ChannelPipeline pipeline = socketChannel.pipeline();
        // ip过滤
        pipeline.addLast(new RuleBasedIpFilter(new IpFilterRuleHandler()));

    }
}
